package com.tfswue.springboot_demo02.listener;

import jakarta.servlet.ServletContextEvent;
import jakarta.servlet.ServletContextListener;
import jakarta.servlet.annotation.WebListener;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

@WebListener
public class MyContextListener implements ServletContextListener{

    private static final Logger log = LoggerFactory.getLogger(MyContextListener.class);

    @Override
    public void contextDestroyed(ServletContextEvent sce) {
        log.info("Web 应用已启动 - 开始初始化");
    }

    @Override
    public void contextInitialized(ServletContextEvent sce) {
        log.info("Web 应用销毁 - 结束");
    }
}
